package com.wxq.yaoxia;

import java.util.ArrayList;
import java.util.List;

import com.wxq.yaoxia.mainborad.YXMainboradActivity;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

public class YXTipsListActivity extends YXBaseActivity {

	ListView tipsLV;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentViewWithTopbar(R.layout.yx_tipslist, R.layout.yx_topbar);
		tipsLV = (ListView) findViewById(R.id.tipsLV);
		setTipsListView();
		tipsLV.setOnItemClickListener(
				new OnItemClickListener()
				{

					@Override
					public void onItemClick(AdapterView<?> parent, View view,
							int position, long id) {
						// TODO Auto-generated method stub
						Intent intent = new Intent();
						
						intent.setClass(YXTipsListActivity.this, YXTipDetailActivity.class);
						
						YXTipsListActivity.this.startActivity(intent);
					}
					
				});
	}
	

	@Override
	public void setTopBarButtonListener() {
		// TODO Auto-generated method stub
		Button leftBtn = (Button) findViewById(R.id.btnLeft);
    	Button rightBtnButton = (Button) findViewById(R.id.btnRight);
    	TextView centerTV = (TextView) findViewById(R.id.centerTV);
    	
    	leftBtn.setVisibility(View.VISIBLE);
    	leftBtn.setText("返回");
    	leftBtn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
    	rightBtnButton.setVisibility(View.VISIBLE);
//    	rightBtnButton.setText("药");
    	rightBtnButton.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(YXTipsListActivity.this, YXMainboradActivity.class);
				YXTipsListActivity.this.startActivity(intent);
			}
		});
    	centerTV.setVisibility(View.VISIBLE);
    	centerTV.setText("帮助");
	}
	
	public List<String> getTipsData() {
		List<String> list = new ArrayList<String>();
		
			list.add("帮助问题1");
			list.add("帮助问题2");
			list.add("帮助问题3");
			list.add("帮助问题4");
			list.add("帮助问题5");
			list.add("帮助问题6");
			list.add("帮助问题7");
			list.add("帮助问题8");
			list.add("帮助问题9");
			list.add("帮助问题10");
			list.add("帮助问题11");
		
		
		return list;
	}
	
	public void setTipsListView() {
		List<String> list = getTipsData();
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.shool_item, list);
		tipsLV.setAdapter(adapter);
	}

}
